package com.zzxx.mapper;

import com.zzxx.entity.Activity;
import com.zzxx.entity.ActivityExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ActivityMapper {
    @SelectProvider(type=ActivitySqlProvider.class, method="countByExample")
    long countByExample(ActivityExample example);

    @DeleteProvider(type=ActivitySqlProvider.class, method="deleteByExample")
    int deleteByExample(ActivityExample example);

    @Delete({
        "delete from activity",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into activity (id, activityName, ",
        "introduce, warning, ",
        "price, ad, src, ",
        "status)",
        "values (#{id,jdbcType=VARCHAR}, #{activityname,jdbcType=VARCHAR}, ",
        "#{introduce,jdbcType=VARCHAR}, #{warning,jdbcType=VARCHAR}, ",
        "#{price,jdbcType=DOUBLE}, #{ad,jdbcType=VARCHAR}, #{src,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER})"
    })
    int insert(Activity row);

    @InsertProvider(type=ActivitySqlProvider.class, method="insertSelective")
    int insertSelective(Activity row);

    @SelectProvider(type=ActivitySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="activityName", property="activityname", jdbcType=JdbcType.VARCHAR),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="warning", property="warning", jdbcType=JdbcType.VARCHAR),
        @Result(column="price", property="price", jdbcType=JdbcType.DOUBLE),
        @Result(column="ad", property="ad", jdbcType=JdbcType.VARCHAR),
        @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    List<Activity> selectByExample(ActivityExample example);

    @Select({
        "select",
        "id, activityName, introduce, warning, price, ad, src, status",
        "from activity",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="activityName", property="activityname", jdbcType=JdbcType.VARCHAR),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="warning", property="warning", jdbcType=JdbcType.VARCHAR),
        @Result(column="price", property="price", jdbcType=JdbcType.DOUBLE),
        @Result(column="ad", property="ad", jdbcType=JdbcType.VARCHAR),
        @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    Activity selectByPrimaryKey(String id);

    @UpdateProvider(type=ActivitySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") Activity row, @Param("example") ActivityExample example);

    @UpdateProvider(type=ActivitySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") Activity row, @Param("example") ActivityExample example);

    @UpdateProvider(type=ActivitySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Activity row);

    @Update({
        "update activity",
        "set activityName = #{activityname,jdbcType=VARCHAR},",
          "introduce = #{introduce,jdbcType=VARCHAR},",
          "warning = #{warning,jdbcType=VARCHAR},",
          "price = #{price,jdbcType=DOUBLE},",
          "ad = #{ad,jdbcType=VARCHAR},",
          "src = #{src,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(Activity row);
}